<template>
  <image
    class="KKImage"
    :style="{
      maxWidth: maxWidth ? maxWidth : 'auto',
      borderRadius: borderRadius ? borderRadius : 0,
    }"
    :mode="mode"
    :src="url"
    @tap="imageClick"
  ></image>
</template>

<script setup lang="ts">
import { ref } from "vue";

const props = defineProps({
  url: {
    type: String,
    default: "",
  },
  mode: {
    type: String,
    default: "aspectFit",
  },
  borderRadius: {
    type: String,
    default: "",
  },
  maxWidth: {
    type: String,
    default: "",
  },
});
const imageClick = () => {
  if (props.url) {
    uni.previewImage({
      urls: [props.url],
    });
  }
};
</script>

<style lang="scss" scoped>
.KKImage {
}
</style>
